<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<link rel="stylesheet" href="../../css/animate.css">
		<link rel="stylesheet" href="../../iconfont/iconfont.css">
		<link rel="stylesheet" href="../../css/mescroll.css">
		<link rel="stylesheet" href="../../css/gloab.css">
		<title>空间</title>
	</head>
	<body>
		<div id="app">
			<div id="public-header">
				<div id="statusbar"></div>
				<header class="public-header">
					<div class="public-header-lf iconfont icon-fanhui" @click="javascript:api.closeWin();"></div>
					<div class="public-header-title">共赢团队</div>
				</header>
			</div>
			<div class="product-category-list" id="nav" style="height:2rem;" v-if="userdata">
				<div class="product-category-list-son" style="box-shadow:none;">
					<div class="product-category-list-header flex wrap">
						<div class="product-category-list-header-lf" style="height:1.1rem;">
							<img src="../../image/public/touxiang.png" alt="" v-if="!userInfo.avatar">
							<img :src="apiUrl1+userInfo.avatar" alt="" v-else>
							<label class="product-category-list-header-label" style="padding:0.01rem 0;">{{userInfo.type_name}}</label>
						</div>
						<div class="product-category-list-header-rt">
							<div class="product-category-list-header-name flex wrap">
								<div class="product-category-list-header-name-lf F2">{{userInfo.nickname}}</div>
							</div>
							<div class="product-category-list-header-name flex">
								<div class="guanggao-details-head-rt flex wrap">
									<div class="guanggao-details-head-rt-son" style="width:100%;">注册时间：<span>{{userInfo.create_time}}</span></div>
									<div class="guanggao-details-head-rt-son" style="width:100%;">微信号：<span v-if="userdata['wechat']">{{userInfo.wechat}}</span><span
										 v-else>未添加</span></div>
									<div class="guanggao-details-head-rt-son" style="width:100%;">发布：<span style="color:#4f9cf6;">{{userdata.total}}</span></div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div id="mescroll" class="mescroll" >
				<div>
					<div class="product-category-list auto" v-for="(item,index) in spacedata">
						<div class="product-category-list-son">
							<!-- <div v-for="data in spacedata"> -->
							<div class="product-category-list-header flex wrap">
								<div class="product-category-list-header-lf" style="height:0.84rem;">
									<img :src="apiUrl1+item.user.avatar" alt="" v-if="item.user.avatar">
									<img src="../../image/public/touxiang.png" alt="" v-else>
								</div>
								<div class="product-category-list-header-rt">
									<div class="product-category-list-header-name flex">
										<div class="product-category-list-header-name-lf F5" style="margin-top:0.16rem;width:100%;height:0.45rem;overflow:hidden;">{{item.user.nickname}}</div>
										<div class="product-category-list-header-name-rt F2" style="margin-top:0.16rem;">
											<span style="border:none;color:#3398ff;text-decoration:underline;" @click="aboutcontet(item.id)">详情&nbsp;></span><br>
										</div>
									</div>
								</div>
							</div>
							<div class="flex wrap">
								<div class="product-category-list-text" style="width:86%;height:1rem;overflow:hidden;" v-if="item.content"
								 v-html="item.content">
								</div>
								<div class="jiafen-quanwen" @click="aboutcontet(item.id)">全文></div>
							</div>
							<div v-if="item.imgs&&item.imgs.length>0">
								<div class="product-category-list-imgs flex wrap">
									<div class="product-category-list-img" v-if="index<3" :style="index==0?'margin-left:0;':''" v-for="(datas,index) in item.imgs"><img
										 @click="seeImg(item,index)" :src="apiUrl1+datas" alt=""></div>
									<div class="product-category-list-img" v-if="item.imgs.length>3" @click="seeImg(data,3)">
										<img :src="apiUrl1+item.imgs[3]" alt="">
										<div class="product-category-list-modify">更多图片</div>
									</div>
								</div>
							</div>
							<div class="product-category-list-footer clearfix">
								<span class="wshy">{{item.block}}</span>
								<span>曝光次数：{{item.view_count}}&nbsp;&nbsp;刷新：{{item.update_time_str}}</span>
								<div class="product-category-list-share fr" @click="share(item.id)">
									<img src="../../image/public/home9.png" alt="">
								</div>
							</div>
							<!-- </div> -->
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="public-progress" style="z-index:9;">
			<img src="../../icon/icon150x150.png" alt="" class="animated infinite flash" style="width:200px;height:200px;display:block;margin:200px auto;">
		</div>
	</body>
	<script src="../../script/api.js"></script>
	<script src="../../script/jquery.js"></script>
	<script src="../../script/mescroll.js"></script>
	<script src="../../script/vue.js"></script>
	<script src="../../script/app.js"></script>
	<script src="../../script/jsencrypt.js"></script>
	<script src="../../script/fastclick.js"></script>

	<script>
		var vm;
		var mescroll;
		var mySwiper;
		apiready = function() {
			api.removeLaunchView();
			setBar("statusbar");
			setFont(750);
			startVue();
			 NewMescroll();
			var top = $("#public-header").outerHeight(true) + $("#nav").outerHeight(true) + 20;
			$("#mescroll").css({
				"top": top + "px"
			});
			$(".public-progress").fadeOut(1000);
			setTimeout(function() {
				$(".public-progress").css({
					"display": "none"
				});
			}, 1000);
		}

		function startVue() {
			vm = new Vue({
				el: "#app",
				data: {
					gdtt: ["", "", "", "", "", ""],
					spacedata: [],
					page: 1,
					showpage: 10,
					userdata: [],
					num: '',
					userInfo:''
				},
				created: function() {
				},
				mounted: function() {
				this.kongjiant();
				this.getUserInfo();
				},
				methods: {
					//获取分享赠送积分
					getIntegral: function() {
						api.ajax({
							url: apiUrl + 'api/home/getIntegral',
							method: 'post',
							data: {
								values: {
									uid: post_en($api.getStorage('uid')),
								},
							}
						}, function(ret, err) {
							if (ret.status) {
								alert(ret.msg);
							} else {
								alert(ret.msg);
							}
						});
					},
					getUserInfo:function(){
					  api.ajax({
					      url: apiUrl+'/api/user/index',
					      method: 'post',
					      data: {
					          values: {
								  uid:api.pageParam['uid'],
					              token:$api.getStorage('token'),
					          },
					      }
					  },function(ret, err){
								console.log(JSON.stringify(ret))
					      if (ret.code==1) {
					        vm.userInfo = ret.data;
					      } else {
					        vm.userInfo = ret.data;
					      }
					  });
					},
					//分享朋友圈
					share: function(index) {
						// alert('开发中......');return;
						var wxPlus = api.require('wxPlus');
						wxPlus.isInstalled(function(ret, err) {
							if (ret.installed) {
								var wxPlus = api.require('wxPlus');
								wxPlus.shareWebpage({
									apiKey: '',
									scene: 'timeline',
									title: '最新项目',
									description: '本条信息由趣引流平台推送，您也想自动引流，自动推广就下载吧。',
									thumb: 'widget://icon/logo.jpg',
									contentUrl: apiUrl + "/index.php/index/index/user/user.html?ids=" + index,
								}, function(ret, err) {
									if (ret.status) {
										vm.getIntegral();
									} else {
										alert(err.code);
									}
								});
							} else {
								alert('当前设备未安装微信客户端');
							}
						});
					},
					seeImg: function(data, index) {
						var array = [];
						for (var i = 0; i < data.imgs.length; i++) {
							array.push(apiUrl1 + data.imgs[i]);
						}
						var photoBrowser = api.require('photoBrowser');
						photoBrowser.open({
							images: array,
							placeholderImg: 'widget://res/img/apicloud.png',
							bgColor: '#000'
						}, function(ret, err) {
							if(ret.eventType == 'longPress'){ save_img(array); }
							if (ret.eventType == 'click') {
								var photoBrowser = api.require('photoBrowser');
								photoBrowser.close();
							}
						});
						photoBrowser.setIndex({
							index: index
						});
					},
					more: function(obj) {
						if (obj.num) {
							vm.page++;
						} else {
							vm.page = 1;
							mescroll.lockUpScroll(false);
						}
						vm.kongjiant();
					},
					kongjiant: function() {
						console.log(api.pageParam['uid'])
						api.showProgress({
							title: '努力加载中...',
							text: '先喝杯茶...',
							modal: false
						});
						var id = api.pageParam.id;
						api.ajax({
							url: apiUrl + '/api/user/zone',
							method: 'post',
							data: {
								values: {
									uid:api.pageParam['uid'],
									token: $api.getStorage('token')
								},
							}
						}, function(ret, err) {
							console.log(JSON.stringify(ret))
							if (vm.page == 1) {
								vm.spacedata = [];
							}
							if (ret.code == 1) {
								if (vm.spacedata.length >= ret.data.total && vm.spacedata.length != 0) {
									msg("我也是有底线的！");
									mescroll.lockUpScroll(true);
									api.hideProgress();
								} else {
									api.hideProgress();
									vm.userdata = ret.data;
									for (var i = 0; i < ret.data.list.length; i++) {
										vm.spacedata.push(ret.data.list[i]);
									}
								}
							} else{
								mescroll.lockUpScroll(true);
								msg("没有过多数据！");
							}
							mescroll.endUpScroll(false);
							mescroll.endSuccess();
						});
					},
					//详情
					aboutcontet: function(id) {
						var id = id;
						var uid = api.pageParam['uid'];
						api.openWin({
							name: 'xiangqing',
							url: '../personal/guanggao_details.html',
							reload: true,
							pageParam: {
								uid: uid,
								id: id
							}
						});
					},
					//全文
					allcontent: function() {
						var id = id;
						var uid = api.pageParam['uid'];
						api.openWin({
							name: 'quan',
							url: '../personal/guanggao_details.html',
							reload: true,
							pageParam: {
								uid: uid,
								id: id
							}
						});
					}
				}
			})
		}

		function NewMescroll() {
			mescroll = new MeScroll("mescroll", {
				down: {
					use: true,
					auto: true,
					// autoShowLoading:true,
					callback: vm.more, //下拉刷新的回调,别写成downCallback(),多了括号就自动执行方法了
				},
				up: {
					use: true,
					auto: false,
					lazyLoad: {
						use: true, // 是否开启懒加载,默认false
						attr: 'imgurl', // 网络地址的属性名 (图片加载成功会移除该属性): <img imgurl='网络图  src='占位图''/>
						showClass: 'mescroll-lazy-in', // 图片加载成功的显示动画: 渐变显示,参见mescroll.css
						delay: 500, // 列表滚动的过程中每500ms检查一次图片是否在可视区域,如果在可视区域则加载图片
						offset: 200 // 超出可视区域200px的图片仍可触发懒加载,目的是提前加载部分图片
					},
					callback: vm.more, //上拉刷新的回调,别写成downCallback(),多了括号就自动执行方法了
				}
			})
		}
	</script>
</html>
